﻿using KPIS.DBM;
using KPIS.GERP.ESS.MODEL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace KPIS.GERP.ESS.DAL
{
    public class D_BgmProjectOperationEdit
    {
        ConvertNullable.ConvertNullable cn = new ConvertNullable.ConvertNullable();

        public DataTable GetFull(int? bgm_year, int? job_site_seq)
        {
            string strSQL;
            DataTable dtb;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(2);

                dbManager.AddParameters(0, "@bgm_year", bgm_year);
                dbManager.AddParameters(1, "@job_site_seq", job_site_seq);

                strSQL = @"
select ed.*, ede.sum_old_amount, ede.sum_add_amount
, ede.sum_old_amount + ede.sum_add_amount as total_amount
, op.bgm_proj_oper_code, op.bgm_proj_oper_name, rs.record_status_name
from bgm_project_operation_edit ed
left join bgm_project_operation op on ed.bgm_proj_oper_seq = op.bgm_proj_oper_seq
left join (select bgm_proj_oper_edit_seq
	, sum(coalesce(old_amount, 0)) sum_old_amount
	, sum(coalesce(add_amount, 0)) sum_add_amount
	from bgm_project_operation_edit_expense
	group by bgm_proj_oper_edit_seq
	) ede on ed.bgm_proj_oper_edit_seq = ede.bgm_proj_oper_edit_seq
left join sys_record_status rs on ed.record_status = rs.record_status
where ed.record_status not like 'D'"
+ (bgm_year.HasValue ? " and op.bgm_year = @bgm_year" : "")
+ (job_site_seq.HasValue ? " and op.job_site_seq = @job_site_seq" : "");

                dtb = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                return dtb;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public DataTable GetExpenseFull(int? bgm_proj_oper_edit_seq)
        {
            string strSQL;
            DataTable dtb;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_seq", bgm_proj_oper_edit_seq);

                strSQL = @"
select *
from bgm_project_operation_edit_expense ede
left join bgm_project_operation_expense ope on ede.bgm_proj_oper_exp_seq = ope.bgm_proj_oper_exp_seq
left join bgm_project_expense pje on ede.bgm_proj_exp_seq = pje.bgm_proj_exp_seq
left join bgm_mas_expense exp on pje.bgm_exp_seq = exp.bgm_exp_seq
where ede.add_amount >= 0"
+ (bgm_proj_oper_edit_seq.HasValue ? " and ede.bgm_proj_oper_edit_seq = @bgm_proj_oper_edit_seq" : "")
;

                dtb = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                return dtb;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public IList<M_BGM_ProjectOperationEditExpense> GetExpenseFull(string bgm_proj_oper_edit_seq)
        {
            string strSQL;
            DataTable dtb;
            IList<M_BGM_ProjectOperationEditExpense> list = new List<M_BGM_ProjectOperationEditExpense>();
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_seq", bgm_proj_oper_edit_seq);

                strSQL = @"
select *
from bgm_project_operation_edit_expense ede
left join bgm_project_operation_expense ope on ede.bgm_proj_oper_exp_seq = ope.bgm_proj_oper_exp_seq
left join bgm_project_expense pje on ede.bgm_proj_exp_seq = pje.bgm_proj_exp_seq
left join bgm_mas_expense exp on pje.bgm_exp_seq = exp.bgm_exp_seq
left join bgm_mas_source s on pje.bgm_source_seq = s.bgm_source_seq
where ede.add_amount > 0"
+ (!string.IsNullOrEmpty(bgm_proj_oper_edit_seq) ? " and ede.bgm_proj_oper_edit_seq = @bgm_proj_oper_edit_seq" : "")
;

                dtb = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                foreach (DataRow dr in dtb.Rows)
                {
                    var info = new M_BGM_ProjectOperationEditExpense()
                    {
                        bgm_proj_oper_edit_exp_seq = Convert.ToInt32(dr["bgm_proj_oper_edit_exp_seq"]),
                        bgm_proj_oper_edit_seq = Convert.ToInt32(dr["bgm_proj_oper_edit_seq"]),
                        bgm_proj_oper_exp_seq = cn.ConvertNullInt(dr["bgm_proj_oper_exp_seq"]),
                        bgm_proj_exp_seq = cn.ConvertNullInt(dr["bgm_proj_exp_seq"]),
                        add_amount = cn.ConvertNullDouble(dr["add_amount"]) ?? 0,
                        old_amount = cn.ConvertNullDouble(dr["old_amount"]) ?? 0,

                        bgm_source_seq = cn.ConvertNullInt(dr["bgm_source_seq"]),
                        bgm_source_name = dr["bgm_source_name"].ToString(),
                        bgm_exp_name = dr["bgm_exp_name"].ToString(),
                        bgm_proj_oper_exp_descr = dr["bgm_proj_oper_exp_descr"].ToString(),
                    };

                    list.Add(info);
                }


                return list;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public M_BGM_ProjectOperationEdit GetInfo(int bgm_proj_oper_edit_seq)
        {
            string strSQL;
            DataTable dtb;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_seq", bgm_proj_oper_edit_seq);

                strSQL = @"
select ed.*, rs.record_status_name
from bgm_project_operation_edit ed
left join sys_record_status rs on ed.record_status = rs.record_status
where ed.bgm_proj_oper_edit_seq = @bgm_proj_oper_edit_seq";

                dtb = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                if (dtb.Rows.Count > 0)
                {
                    DataRow dr = dtb.Rows[0];

                    M_BGM_ProjectOperationEdit model = new M_BGM_ProjectOperationEdit
                    {
                        bgm_proj_oper_edit_seq = cn.ConvertNullInt(dr["bgm_proj_oper_edit_seq"]) ?? 0,
                        bgm_proj_oper_edit_code = dr["bgm_proj_oper_edit_code"].ToString(),
                        bgm_proj_oper_edit_date = cn.ConvertNullDateTime(dr["bgm_proj_oper_edit_date"]),
                        bgm_proj_oper_seq = cn.ConvertNullInt(dr["bgm_proj_oper_seq"]),
                        emp_seq = cn.ConvertNullInt(dr["emp_seq"]),
                        remarks = dr["remarks"].ToString(),
                        record_status = dr["record_status"].ToString(),
                        record_status_name = dr["record_status_name"].ToString(),
                        created_by = cn.ConvertNullInt(dr["created_by"]),
                        created_when = cn.ConvertNullDateTime(dr["created_when"]),
                        updated_by = cn.ConvertNullInt(dr["updated_by"]),
                        updated_when = cn.ConvertNullDateTime(dr["updated_when"]),
                    };

                    return model;
                }

                return null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public int Insert(M_BGM_ProjectOperationEdit info)
        {
            string strSQL;
            int nSeq = 0;
            string strNewCode = "";
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(11);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_seq", info.bgm_proj_oper_edit_seq);
                dbManager.AddParameters(1, "@bgm_proj_oper_seq", info.bgm_proj_oper_seq);
                dbManager.AddParameters(2, "@bgm_proj_oper_edit_code", info.bgm_proj_oper_edit_code);
                dbManager.AddParameters(3, "@bgm_proj_oper_edit_date", info.bgm_proj_oper_edit_date);
                dbManager.AddParameters(4, "@emp_seq", info.emp_seq);
                dbManager.AddParameters(5, "@remarks", info.remarks);

                dbManager.AddParameters(6, "@record_status", SystemInfo._WorkRecordStatus);
                dbManager.AddParameters(7, "@created_by", info.created_by);
                dbManager.AddParameters(8, "@created_when", DateTime.Now);
                dbManager.AddParameters(9, "@updated_by", info.updated_by);
                dbManager.AddParameters(10, "@updated_when", DateTime.Now);

                strSQL = "select edit.bgm_proj_oper_seq, coalesce(max(edit.bgm_proj_oper_edit_code), '0') as max_code, op.bgm_proj_oper_code"
                    + " from bgm_project_operation_edit edit"
                    + " left join bgm_project_operation op on edit.bgm_proj_oper_seq = op.bgm_proj_oper_seq"
                    + " where edit.bgm_proj_oper_seq = @bgm_proj_oper_seq"
                    + " and edit.record_status not like 'D'"
                    + " group by edit.bgm_proj_oper_seq, op.bgm_proj_oper_code";
                DataTable dtb = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                if (dtb.Rows.Count > 0 && !string.IsNullOrEmpty(dtb.Rows[0]["max_code"].ToString()))
                {
                    strNewCode = dtb.Rows[0]["max_code"].ToString();
                    string[] strArray = strNewCode.Split('-');
                    string strRunning = "00";
                    int i;

                    if (strArray.Count() > 0)
                    {
                        strRunning = strArray[strArray.Count() - 1];
                    }

                    strRunning = (int.TryParse(strRunning, out i) ? Convert.ToInt32(strRunning) + 1 : 1).ToString("00");
                    strNewCode = dtb.Rows[0]["bgm_proj_oper_code"].ToString() + "-" + strRunning;
                }
                else
                {
                    strSQL = "select bgm_proj_oper_code"
                        + " from bgm_project_operation"
                        + " where bgm_proj_oper_seq = @bgm_proj_oper_seq";
                    DataTable dtb2 = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                    if (dtb2 != null && dtb2.Rows.Count > 0)
                    {
                        strNewCode = dtb2.Rows[0][0].ToString() + "-01";
                    }
                }

                strSQL = "INSERT INTO bgm_project_operation_edit"
                    + "(bgm_proj_oper_seq, bgm_proj_oper_edit_code, bgm_proj_oper_edit_date, emp_seq, remarks"

                    + ", record_status, created_by, created_when)"
                    + " VALUES (@bgm_proj_oper_seq"
                        + ", '" + strNewCode + "'"
                        + ", @bgm_proj_oper_edit_date"
                        + ", @emp_seq"
                        + ", @remarks"

                        + ", @record_status"
                        + ", @created_by"
                        + ", @created_when"
                        + ");"
                        + " SELECT scope_identity();";
                nSeq = cn.ConvertNullInt(dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0].Rows[0][0]) ?? 0;

                return nSeq;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public void Update(M_BGM_ProjectOperationEdit info)
        {
            string strSQL;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(11);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_seq", info.bgm_proj_oper_edit_seq);
                dbManager.AddParameters(1, "@bgm_proj_oper_seq", info.bgm_proj_oper_seq);
                dbManager.AddParameters(2, "@bgm_proj_oper_edit_code", info.bgm_proj_oper_edit_code);
                dbManager.AddParameters(3, "@bgm_proj_oper_edit_date", info.bgm_proj_oper_edit_date);
                dbManager.AddParameters(4, "@emp_seq", info.emp_seq);
                dbManager.AddParameters(5, "@remarks", info.remarks);

                dbManager.AddParameters(6, "@record_status", SystemInfo._WorkRecordStatus);
                dbManager.AddParameters(7, "@created_by", info.created_by);
                dbManager.AddParameters(8, "@created_when", DateTime.Now);
                dbManager.AddParameters(9, "@updated_by", info.updated_by);
                dbManager.AddParameters(10, "@updated_when", DateTime.Now);

                strSQL = "UPDATE bgm_project_operation_edit"
                    + " set bgm_proj_oper_edit_date = @bgm_proj_oper_edit_date"
                    + ", remarks = @remarks"
                    + ", updated_by = @updated_by"
                    + ", updated_when = @updated_when"
                    + " where bgm_proj_oper_edit_seq = @bgm_proj_oper_edit_seq";
                dbManager.ExecuteNonQuery(CommandType.Text, strSQL);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public bool HaveAmountExist(int bgm_proj_oper_edit_seq)
        {
            string strSQL;
            DataRowCollection drc = null;
            bool bPass = true;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(2);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_seq", bgm_proj_oper_edit_seq);
                dbManager.AddParameters(1, "@delete_record_status", SystemInfo._DeleteRecordStatus);

                strSQL = "select coalesce(opexp.amount, 0) as amount"
                    + ", coalesce(pjre.remain_amount, 0) as remain_amount"
                    + " from bgm_project_operation_edit op"
                    + " left join bgm_project_operation op2 on op.bgm_proj_oper_seq = op2.bgm_proj_oper_seq"
                    + " left join (select opexp.bgm_proj_oper_edit_seq, exp.bgm_exp_grp_seq"
                        + ", sum(coalesce(add_amount, 0)) as amount"
                        + " from bgm_project_operation_edit_expense opexp"
                        + " left join bgm_project_expense pjexp on opexp.bgm_proj_exp_seq = pjexp.bgm_proj_exp_seq"
                        + " left join bgm_mas_expense exp on pjexp.bgm_exp_seq = exp.bgm_exp_seq"
                        + " group by opexp.bgm_proj_oper_edit_seq, exp.bgm_exp_grp_seq"
                        + ") opexp on op.bgm_proj_oper_edit_seq = opexp.bgm_proj_oper_edit_seq"
                    + " left join (select pjexp.bgm_proj_seq, exp.bgm_exp_grp_seq"
                        + ", sum(coalesce(pjre.cal_amount, 0)) as remain_amount"
                        + " from bgm_project_report pjre"
                        + " left join bgm_project_expense pjexp on pjre.bgm_proj_exp_seq = pjexp.bgm_proj_exp_seq"
                        + " left join bgm_mas_expense exp on pjexp.bgm_exp_seq = exp.bgm_exp_seq"
                        + " where pjre.record_status not like @delete_record_status"
                        + " group by pjexp.bgm_proj_seq, exp.bgm_exp_grp_seq"
                        + ") pjre on op2.bgm_proj_seq = pjre.bgm_proj_seq"
                        + " and opexp.bgm_exp_grp_seq = pjre.bgm_exp_grp_seq"
                    + " WHERE op.bgm_proj_oper_edit_seq = @bgm_proj_oper_edit_seq";
                drc = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0].Rows;

                for (int i = 0; i < drc.Count; i++)
                {
                    double dBathAmount = Convert.ToDouble(drc[i]["amount"]);
                    double dRemainAmount = Convert.ToDouble(drc[i]["remain_amount"]);

                    if (dBathAmount > dRemainAmount)
                    {
                        bPass = false;
                        return bPass;
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                dbManager.Dispose();
            }

            return bPass;
        }

        public bool ChangeStatus(int bgm_proj_oper_edit_seq, string record_status, int emp_seq)
        {
            string strSQL;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);

            if (record_status == "A" || record_status == "F")
            {
                if (!HaveAmountExist(bgm_proj_oper_edit_seq))
                {
                    return false;
                }
            }

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(4);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_seq", bgm_proj_oper_edit_seq);

                dbManager.AddParameters(1, "@record_status", record_status);
                dbManager.AddParameters(2, "@updated_by", emp_seq);
                dbManager.AddParameters(3, "@updated_when", DateTime.Now);

                strSQL = "UPDATE bgm_project_operation_edit"
                    + " set record_status = @record_status"
                    + ", updated_by = @updated_by"
                    + ", updated_when = @updated_when"
                    + " where bgm_proj_oper_edit_seq = @bgm_proj_oper_edit_seq";
                dbManager.ExecuteNonQuery(CommandType.Text, strSQL);

                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public int InsertExpense(M_BGM_ProjectOperationEditExpense info)
        {
            string strSQL;
            int nSeq = 0;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(10);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_exp_seq", info.bgm_proj_oper_edit_exp_seq);
                dbManager.AddParameters(1, "@bgm_proj_oper_edit_seq", info.bgm_proj_oper_edit_seq);
                dbManager.AddParameters(2, "@bgm_proj_oper_exp_seq", info.bgm_proj_oper_exp_seq);
                dbManager.AddParameters(3, "@bgm_proj_exp_seq", info.bgm_proj_exp_seq);
                dbManager.AddParameters(4, "@old_amount", info.old_amount);
                dbManager.AddParameters(5, "@add_amount", info.add_amount);

                dbManager.AddParameters(6, "@created_by", info.created_by);
                dbManager.AddParameters(7, "@created_when", DateTime.Now);
                dbManager.AddParameters(8, "@updated_by", info.updated_by);
                dbManager.AddParameters(9, "@updated_when", DateTime.Now);

                strSQL = "INSERT INTO bgm_project_operation_edit_expense"
                    + "(bgm_proj_oper_edit_seq, bgm_proj_oper_exp_seq, bgm_proj_exp_seq, old_amount, add_amount"

                    + ", created_by, created_when)"
                    + " VALUES (@bgm_proj_oper_edit_seq"
                        + ", @bgm_proj_oper_exp_seq"
                        + ", @bgm_proj_exp_seq"
                        + ", @old_amount"
                        + ", @add_amount"

                        + ", @created_by"
                        + ", @created_when"
                        + ");"
                        + " SELECT scope_identity();";
                nSeq = cn.ConvertNullInt(dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0].Rows[0][0]) ?? 0;

                return nSeq;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public void UpdateExpense(M_BGM_ProjectOperationEditExpense info)
        {
            string strSQL;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(10);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_exp_seq", info.bgm_proj_oper_edit_exp_seq);
                dbManager.AddParameters(1, "@bgm_proj_oper_edit_seq", info.bgm_proj_oper_edit_seq);
                dbManager.AddParameters(2, "@bgm_proj_oper_exp_seq", info.bgm_proj_oper_exp_seq);
                dbManager.AddParameters(3, "@bgm_proj_exp_seq", info.bgm_proj_exp_seq);
                dbManager.AddParameters(4, "@old_amount", info.old_amount);
                dbManager.AddParameters(5, "@add_amount", info.add_amount);

                dbManager.AddParameters(6, "@created_by", info.created_by);
                dbManager.AddParameters(7, "@created_when", DateTime.Now);
                dbManager.AddParameters(8, "@updated_by", info.updated_by);
                dbManager.AddParameters(9, "@updated_when", DateTime.Now);

                strSQL = "UPDATE bgm_project_operation_edit_expense"
                    + " set old_amount = @old_amount"
                    + ", add_amount = @add_amount"
                    + ", updated_by = @updated_by"
                    + ", updated_when = @updated_when"
                    + " where bgm_proj_oper_edit_exp_seq = @bgm_proj_oper_edit_exp_seq";
                dbManager.ExecuteNonQuery(CommandType.Text, strSQL);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public void DeleteExpense(int bgm_proj_oper_edit_exp_seq)
        {
            string strSQL;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);

                dbManager.AddParameters(0, "@bgm_proj_oper_edit_exp_seq", bgm_proj_oper_edit_exp_seq);

                dbManager.AddParameters(1, "@record_status", SystemInfo._DeleteRecordStatus);

                strSQL = "DELETE from bgm_project_operation_edit_expense"
                    + " where bgm_proj_oper_edit_exp_seq = @bgm_proj_oper_edit_exp_seq";
                dbManager.ExecuteNonQuery(CommandType.Text, strSQL);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
    }

    public class M_BGM_ProjectOperationEdit
    {
        public M_BGM_ProjectOperationEdit()
        {

        }

        public int bgm_proj_oper_edit_seq
        {
            get;
            set;
        }

        public int? bgm_proj_oper_seq
        {
            get;
            set;
        }

        public string bgm_proj_oper_edit_code
        {
            get;
            set;
        }

        public DateTime? bgm_proj_oper_edit_date
        {
            get;
            set;
        }

        public int? emp_seq
        {
            get;
            set;
        }

        public string remarks
        {
            get;
            set;
        }

        public string record_status
        {
            get;
            set;
        }

        public string record_status_name
        {
            get;
            set;
        }

        public Nullable<int> created_by
        {
            get;
            set;
        }

        public Nullable<DateTime> created_when
        {
            get;
            set;
        }

        public Nullable<int> updated_by
        {
            get;
            set;
        }

        public Nullable<DateTime> updated_when
        {
            get;
            set;
        }
    }

    public class M_BGM_ProjectOperationEditExpense
    {
        public M_BGM_ProjectOperationEditExpense()
        {

        }

        public int bgm_proj_oper_edit_exp_seq
        {
            get;
            set;
        }

        public int bgm_proj_oper_edit_seq
        {
            get;
            set;
        }

        public int? bgm_proj_oper_exp_seq
        {
            get;
            set;
        }

        public int? bgm_proj_exp_seq
        {
            get;
            set;
        }

        public double old_amount
        {
            get;
            set;
        }

        public double add_amount
        {
            get;
            set;
        }

        public Nullable<int> created_by
        {
            get;
            set;
        }

        public Nullable<DateTime> created_when
        {
            get;
            set;
        }

        public Nullable<int> updated_by
        {
            get;
            set;
        }

        public Nullable<DateTime> updated_when
        {
            get;
            set;
        }

        public int? bgm_source_seq { get; set; }
        public string bgm_source_name { get; set; }
        public string bgm_exp_name { get; set; }
        public string bgm_proj_oper_exp_descr { get; set; }
    }
}
